/*
 * 项目组:
 *            = = =      =       =      =       =       =
 *          =            =       =       =     = =     =
 *         =             = = = = =        =   =   =   =
 *          =            =       =         = =     = =
 *            = = =      =       =          =       =
 */
$(function(){
    // 模拟数据 -> 开始
    var bookTypes = {
        literature:[
            {
                name:"小说",
                content:["外国小说","中国当代小说","中国古典小说","中国近现代小说","悬疑推理","科幻小说","世界名著四大名著","作品集"]
            },
            {
                name:"文集",
                content:["外国诗歌","中国古诗词","中国现当代诗歌","外国散文","中国现当代散文","中国古代散文文学理论","文集","戏剧"]
            },
            {
                name:"青春文学",
                content:["玄幻/科幻","悬疑/惊悚","叛逆/成长","爆笑/无厘头","校园","港台青春文学","外国青春文学"]
            }
        ],
        sciences:[
            {
                name:"历史",
                content:["中国史","世界史","地方史志","历史知识读物","史料典籍","史学理论","考古文物","民族史志"]
            },
            {
                name:"政治/哲学",
                content:["政治","军事","中国政治","国际政治","外交/国际关系哲学","宗教","美学 哲学知识读物","中国古代哲学"]
            },
            {
                name:"文化",
                content:["世界文化","中国文化","中国民俗","地域文化","文化理论","文化评述","神秘现象"]
            },
            {
                name:"社会科学",
                content:["心理学","人类学","教育","社会学","新闻传播出版","语言文字"]
            },
            {
                name:"经济/管理",
                content:["经济理论","中国经济","国际经济","经济通俗读物","保险","会计","金融投资 市场营销","管理学","电子商务"]
            },
            {
                name:"成功励志",
                content:["成功激励","口才演讲","名人励志","人际交往","人生哲学","心灵修养","性格习惯"]
            },
            {
                name:"法律",
                content:["法的理论","法律法规","国际法","经济法"]
            }  
        ],
        juvenile:[
            {
                name:"儿童文学",
                content:["中国儿童文学","外国儿童文学","童话","小说","寓言传说"]
            },
            {
                name:"绘本",
                content:["动漫/卡通"]
            },
            {
                name:"科普",
                content:["百科科普","百科","历史读物","生活常识","益智游戏","传统文化"]
            },
            {
                name:"其他",
                content:["幼儿启蒙","少儿英语","励志/成长","艺术课堂"]
            },
            {
                name:"年龄馆",
                content:["0-2岁","3-6岁","7岁及以上"]
            }
        ],
        art:[
            {
                name:"绘画",
                content:["绘画理论","国画","油画","素描速写","水粉水彩"]
            },
            {
                name:"书法纂刻",
                content:["碑帖","技法教程","书法理论","硬笔书法","字帖","篆刻"]
            },
            {
                name:"摄影/设计",
                content:["设计","摄影后期","摄影教程","摄影理论","摄影器材","数码摄影","作品集"]
            },
            {
                name:"舞台影视艺术",
                content:["影视理论","影视赏析","影视制作","舞台/戏曲艺术"]
            },
            {
                name:"音乐",
                content:["钢琴","吉它","理论/欣赏","声乐","通俗音乐","外国音乐","中国民族音乐","作曲/指挥"]
            },
            {
                name:"收藏鉴赏",
                content:["宝石","雕品","古代家具","钱币","收藏百科","收藏随笔","书画","陶瓷","玉器"]
            },
            {
                name:"更多",
                content:["艺术理论","雕塑","工艺美术","建筑艺术","民间艺术","人体艺术","艺术类考试"]
            }
        ],
        life:[
            {
                name:"美食",
                content:["饮食文化","保健食谱","家常食谱","八大菜系","餐饮指南","世界美食"]
            },
            {
                name:"保健/心理健康",
                content:["健康百科","健身","心理健康","中老年","中医保健常见病"]
            },
            {
                name:"旅游",
                content:["旅游随笔","旅游攻略","旅游画册","城市自助游","国内自助游","国外自助游","地图地理"]
            },
            {
                name:"孕产育儿",
                content:["孕产百科","育儿百科"]
            },
            {
                name:"更多",
                content:["美丽妆扮","两性关系","家居休闲","个人理财"]
            }
        ],
        culture:[
            {
                name:"中小学教辅",
                content:["语文阅读","拓展读物","高考","初中通用","高中通用","工具书教师用书"]
            },
            {
                name:"外语",
                content:["英语读物","职业英语","英语考试","大学英语","少儿英语"]
            },
            {
                name:"教材",
                content:["研究生/本科/专科教材 ","职业技术培训","中小学教材"]
            },
            {
                name:"计算机",
                content:["操作系统/系统开发","数据库","信息安全程序设计","电脑杂志","计算机教材","计算机考试认证","计算机理论","计算机体系结构","家庭与办公室用书","企业软件开发与实施","人工智能软件工程/开发项目管理"]
            },
            {
                name:"更多",
                content:["考试","家庭教育","自然科学","科普读物","医学","农林业","工业技术","建筑"]
            }
        ]
    }
    // 模拟数据 <- 结束

    // 书品分类 二级菜单数据展示
    // 该 事件 只提供 思路 和 模拟数据操作，实际项目开发需要自行修改
    $("#bookTypesMenu > li:not(:last-child)").hover(function(){
        $("#typesDetail").html("");
        var key = $(this).attr("data-type");
        var types = bookTypes[key];
        types.forEach(function(t){
            var $typeList = $("<ul></ul>");
            t.content.forEach(function(item){
                $typeList.append(`<li><a href="./bookList.html">${ item }</a></li>`)
            });
            $('<div class="topbar-detail-types"></div>').append(`<p>${ t.name }</p>`)
                                                       .append($typeList)
                                                       .appendTo($("#typesDetail"));
        });
        $("#typesDetail").css("display","block");
    },function(){
        $("#typesDetail").css("display","none");
    });

// ----------------------------------------------------------------
    // 二级菜单显示效果操作，请勿修改，除非你知道在干嘛 ->
    $("#typesDetail").hover(function(){
        $(this).css("display","block");
    },function(){
        $(this).css("display","none");
    });
    // <- 二级菜单显示效果操作，请勿修改，除非你知道在干嘛
// ----------------------------------------------------------------
});